﻿//
// XN4SL - Xna Framework for Silverlight.
//
using Xn4Sl.Framework;
using System;
using System.Windows;
using System.Windows.Controls;

namespace Xn4Sl.Framework.Graphics
{
    /// <summary>
    /// Defines the window dimensions of a render-target surface.
    /// </summary>
    public struct Viewport
    {
        /// <summary>
        /// Gets the aspect ratio used by the viewport.
        /// </summary>
        public float AspectRatio
        {
            get
            {
                return this.Width / this.Height;
            }
        }

        /// <summary>
        /// Gets or sets the height dimension of the viewport on the render-target surface,
        /// in pixels.
        /// </summary>
        public int Height { get; set; }

        /// <summary>
        /// Gets or sets the maximum depth of the clip volume.
        /// </summary>
        public float MaxDepth { get; set; }

        /// <summary>
        /// Gets or sets the minimum depth of the clip volume.
        /// </summary>
        public float MinDepth { get; set; }

        /// <summary>
        /// Returns the title safe area of the current viewport.
        /// </summary>
        public Rectangle TitleSafeArea
        {
            get
            {
                return new Rectangle(0, 0, this.Width, this.Height);
            }
        }

        /// <summary>
        /// Gets or sets the width dimension of the viewport on the render-target surface,
        ///  in pixels.
        /// </summary>
        public int Width 
        {
            get
            {
                return this.width;
            }
            set
            {
                this.width = value;
            }
        }
        int width;

        /// <summary>
        /// Gets or sets the pixel coordinate of the upper-left corner of the viewport
        /// on the render-target surface.
        /// </summary>
        public int X { get; set; }
        
        /// <summary>
        /// Gets or sets the pixel coordinate of the upper-left corner of the viewport
        ///  on the render-target surface.
        /// </summary>
        public int Y { get; set; }
    }
}
